// 获取时间
export function parseTime() {
  const currentDate = new Date();
  const year = currentDate.getFullYear();
  const month = String(currentDate.getMonth() + 1).padStart(2, "0");
  const day = String(currentDate.getDate()).padStart(2, "0");
  const formattedDate = `${year}.${month}.${day}`;

  // 使用中文语言选项
  const dayOfWeek = new Intl.DateTimeFormat("zh-CN", {
    weekday: "long",
  }).format(currentDate);
  // const formattedTime = currentDate.toLocaleTimeString("en-US", {
  //   hour12: false,
  //   hour: "2-digit",
  //   minute: "2-digit",
  //   second: "2-digit",
  // });

  // 自定义格式化时间部分
  const hours = String(currentDate.getHours()).padStart(2, "0");
  const minutes = String(currentDate.getMinutes()).padStart(2, "0");
  const seconds = String(currentDate.getSeconds()).padStart(2, "0");
  const formattedTime = `${hours}:  ${minutes}:  ${seconds}`;
  return {
    formattedDate,
    dayOfWeek,
    formattedTime,
  };
}
